#include "widget.h"
#include "ui_widget.h"
#include<QDebug>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
    srand(time(0));
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_pushButton_target_clicked()
{
    QRect rect=ui->pushButton_target->geometry();
    qDebug()<<rect;
}

void Widget::on_pushButton_up_clicked()
{
    QRect rect=ui->pushButton_target->geometry();
//    rect.setY(rect.y()-5);
//    ui->pushButton_target->setGeometry(rect);
    ui->pushButton_target->setGeometry(rect.x(),rect.y()-5,rect.width(),rect.height());
}

void Widget::on_pushButton_down_clicked()
{
    QRect rect=ui->pushButton_target->geometry();
//    rect.setY(rect.y()+5);
//    ui->pushButton_target->setGeometry(rect);
    ui->pushButton_target->setGeometry(rect.x(),rect.y()+5,rect.width(),rect.height());
}

void Widget::on_pushButton_left_clicked()
{
    QRect rect=ui->pushButton_target->geometry();
//    rect.setX(rect.x()-5);
//    ui->pushButton_target->setGeometry(rect);
    ui->pushButton_target->setGeometry(rect.x()-5,rect.y(),rect.width(),rect.height());
}

void Widget::on_pushButton_right_clicked()
{
    QRect rect=ui->pushButton_target->geometry();
//    rect.setX(rect.x()+5);
//    ui->pushButton_target->setGeometry(rect);
    ui->pushButton_target->setGeometry(rect.x()+5,rect.y(),rect.width(),rect.height());
}



void Widget::on_pushButton_accept_clicked()
{
    ui->label->setText("nice to meet you!");
}

//void Widget::on_pushButton_reject_clicked()
//{
//    int height=ui->pushButton_reject->geometry().height();
//    int width=ui->pushButton_reject->geometry().width();
//    int x=rand()%height;
//    int y=rand()%width;
//    ui->pushButton_reject->move(x,y);
//}

void Widget::on_pushButton_reject_pressed()
{
    int height=ui->pushButton_reject->geometry().height();
    int width=ui->pushButton_reject->geometry().width();
    int x=rand()%height;
    int y=rand()%width;
    ui->pushButton_reject->move(x,y);
}
